package com.esender.ordermanage.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderManageMapper {
    @Insert("insert into tb_order(id) values(#{id})")
    void save(String id);

    /**
     * for update 对查询结果进行行级锁，确保查询结果不会被其他事务修改，使用时必须在开启事务的过程中进行使用
     * @param id
     * @return
     */
    @Select("select order_state from tb_order where id = #{id} for update ")
    int findOrderStateById(String id);

    @Update("update tb_order set order_state = #{orderState} where id = #{id}")
    int updateOrderStateById(String id,int orderState);
}
